<?php
	$fields_arr = array(
		'username'=>'用户名',
		'mobile'=>'手机号码',
		'jobno'=>'工号',
		'email'=>'电子邮箱',
		'name'=>'姓名',
		'role_name'=>'角色',
		'last_login_time'=>'最后登陆时间',
		'last_login_ip'=>'最后登陆ip',
		'status'=>'账户状态',
		'manager_name'=>'添加人',
		'addtime'=>'添加时间',
		'updatetime'=>'更新时间',
		'operation'=>'操作',
	);
	if(!$custom_field_arr){
		$custom_field_arr = array_flip($fields_arr);
	}
	$fields_arr_new = array_merge($custom_field_arr,array_flip($fields_arr));
	$fields_arr_new = array_unique($fields_arr_new);
?>
{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<link rel="stylesheet" href="/res/js/framework/nestable/nestable.css">
<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->

		<section class="left-section">
			<dl id="leftNav" data-type="system">
				<dt><i class="glyphicon glyphicon-eye-open"></i> 系统管理</dt>
				{if (in_case_array('admin/node',$priv) || empty($priv)) && $appConfigs['originator_id'] == adminId()}
				<dd><a class="mbh" href="{url /admin/node/index}">权限列表</a></dd>
				{/if}
				{if in_case_array('admin/role',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/role/index}">角色列表</a></dd>
				{/if}
				{if in_case_array('admin/manager',$priv) || empty($priv)}
				<dd><a class="mb active" href="{url /admin/manager/index}">管理员列表</a></dd>
				{/if}
			</dl>
		</section>

		<!-- left side end-->


		<!-- main content start-->
		<section class="right-section" id="right-section">
			{include admin.inc.bread}
			<h2 class="header">{$title}</h2>
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<div class="inner-container">
					<form class="form-inline search-form" role="form" id="J_List_Form">
						<nav class="inline-form">
							<a class="btnlg mb"  href="{$add_url}"><i class="css-add"></i>添加管理员</a>
							<div class="r">
								<div class="css-select-group">
									<div class="css-select">
										<div class="chosen">
											<span></span>
											<i class="angle-down"></i>
											<input type="hidden" name="select_mix_option1" value="{$select_mix_option1}">
										</div>
										<ul>
											<li data-value="username">登录账号</li>
											<li data-value="jobno">工号</li>
											<li data-value="name">姓名</li>
											<li data-value="mobile">联系方式</li>
											<li data-value="email">Email</li>
										</ul>
									</div><input type="text" class="form-control input-sm" maxlength="{maxlength}" placeholder="关键词" name="select_mix_option_value1" value="{$select_mix_option_value1}">
								</div>
								<div class="css-select-group">
								<div class="css-select">
									<div class="chosen">
										<span></span>
										<i class="angle-down"></i>
										<input type="hidden" name="select_mix_option2" value="{$select_mix_option2}">
									</div>
									<ul>
										<li data-value="add_time">创建时间</li>
										<li data-value="last_login_time">最后登陆时间</li>
									</ul>
								</div>
								<div class="form-group">
									<div class="input-group">

										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="start_time" value="{$start_time}"
											   placeholder="开始时间" />

										<div class="input-group-addon">
											-
										</div>
										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="end_time" value="{$end_time}"
											   placeholder="结束时间" />
									</div>
								</div>
									</div>
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											账户状态
										</div>
										<div class="css-select">
											<div class="chosen">
												<span></span>
												<i class="angle-down"></i>
												<input type="hidden" name="s_status" value="{$s_status}">
											</div>
											<ul>
												<li data-value="">--请选择--</li>
												<li data-value="1">启用</li>
												<li data-value="0">禁用</li>
											</ul>
										</div>
									</div>
								</div>

								<input type="hidden" name="order" value="{$order}">
								<button type="submit" class="btnlg mb">搜索</button>
								<input type="hidden" name="pagesize" value="{$pagesize}" >
								<button type="button" class="btnlg mb" id="J_Export_btn">导出Excel</button>
								<button type="button" class="btnlg mb" id="defined">配置列表项</button>
							</div>
						</nav>

					<!--</form>
					<form id="J_List_Form">-->
						<div class="table-responsive">
							<table id="J_ListTable" class="table  table-hover  table-striped">
								<thead>
									<tr>
										<th width="20">
											<label class="css-checkbox">
												<input type="checkbox" class="check-all">
												<span></span>
											</label>
										</th>
										{loop $custom_field_arr $k $v}
										<th>{$fields_arr[$v]}</th>
										{/loop}
									</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td style="text-align:center;" colspan="12" class="empty-table-td">{$emptyRecord}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td>
										{if $myInfo['id']!=$value[id]}
										<label class="css-checkbox">
											<input type="checkbox"  name="ids[]" value="{$value[id]}">
											<span></span>
										</label>
										{/if}
									</td>
									{loop $custom_field_arr $v}
									{if $v=='last_login_ip'}
									<td>{expr long2ip($value[last_login_ip])}</td>
									{else}
									{if $v=='role_name'}
									<td>{if $value[role_name]}{$value[role_name]}{else}超级管理员{/if}</td>
									{else}
									{if $v=='status'}
									<td>
										<label class="css-switch">
											<input type="checkbox" data-id="{$value[id]}" data-size="mini"
												   {if $value[status]}checked{/if} {if $myInfo['id'] == $value[id]}disabled="disabled"{/if} />
											<span></span>
										</label>
									</td>
									{else}
									{if $v=='operation'}
									<td>
										{if $myInfo['id'] != $value[id]}
										{if in_array('admin/manager/edit',$priv) || empty($priv)}
										<a href="{$edit_url}?id={$value[id]}" class="btnsm-primary">编辑</a>
										{/if}
										{if in_array('admin/manager/delete',$priv) || empty($priv)}
										<a href="{$delete_url}?id={$value[id]}" class="btnsm-danger item-remove">删除</a>
										{/if}
										{else}
										{if in_array('admin/manager/edit',$priv) || empty($priv)}
										<button disabled="disabled" class="btnsm-primary">编辑</button>
										{/if}
										{if in_array('admin/manager/delete',$priv) || empty($priv)}
										<button disabled="disabled" class="btnsm-danger item-remove">删除</button>
										{/if}
										{/if}
									</td>
									{else}
									<td>{$value[$v]}</td>
									{/if}
									{/if}
									{/if}
									{/if}
									{/loop}
								</tr>
								{/loop}
							</table>
						</div>
					</form>
                    <div class="footer">
                        <!--批量操作 start-->
                        <div class="btn-group dropup" data-act="operateAll">
                            <button class="btnlg mb dropdown-toggle" data-toggle="dropdown" aria-expanded="false" disabled>批量操作<span class="caret"></span></button>
                            <ul class="dropdown-menu" role="menu">
                                <li><a href="javascript:;" data-action="on">启用</a></li>
                                <li><a href="javascript:;" data-action="off">禁用</a></li>
                            </ul>
                        </div>
                        <!--批量操作 end-->
                        {$pagemenu}
                    </div>
				</div>
			</div>
		</section>
	</div>
</div>

<!--footer section start-->
{include admin.inc.footer}
<!--footer section end-->

<!--tmpl-script-->

<!--自定义start-->
<script id="defined_table" type="text/html">
	<div>
		<form id="defined_edit" class="form-horizontal">
			<input type="hidden" name="url" value="{$module}/{$action}/{$method}">
			<div class="de_title"><i></i>拖动改变顺序</div>
			<div class="cf">
				<div class="dd" id="nestable3">
					<ol class="dd-list">
						{loop $fields_arr_new $v}
						<li class="dd-item dd3-item" data-id="{$v}">
							<div class="dd-handle dd3-handle"></div><div class="dd3-content">
							<label class="css-checkbox">
								<input type="checkbox" {if in_array($v,$custom_field_arr)}checked="checked"{/if} name="field_arr[]" value="{$v}">
								<span>{$fields_arr[$v]}</span>
							</label>
						</div>
						</li>
						{/loop}
					</ol>
				</div>
			</div>
		</form>
	</div>
</script>
<!--自定义end-->

<!-- assocalert -->
<script id="admin_role-assoc-box" type="text/html">
<div class="assoc-alertbox">
	<div class="searchbar">
		<form class="assoc-foreign-form form-inline">
			<!--tmpl-search-->

			<!-- searchinput -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						
					</div>
					<input type="text" class="form-control input-sm" maxlength="50" placeholder="" name="s_name" value="{$s_name}">
				</div>
			</div>
			
			
			
			
			
			
			
			

			<input type="hidden" name="order" value="{$order}">
			<input type="btn" class="btn btn-sm btn-success assoc-search-btn" value="搜索"/>
		</form>
	</div>
	<div class="content">
	
	</div>
	<div class="paginate">

	</div>
</div>
</script>

<!-- assoclist -->
<script id="admin_role-assoc-tablelist" type="text/html">
<table class="table  table-condense">
	<tr>
		<th><input type="checkbox" id="assoc-selectall" ></th>
		<!--tmpl-th-->

		<th></th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
		<th>AppId</th>

	</tr>
	{[loop items item]}
	<tr>
		<td><input type="checkbox" name="assoc[]" value="{[item.id]}"></td>
		<!--tmpl-td-->

		<td>{[item.name]}</td>
		<td>{[item.role_key]}</td>
		<td>{[item.remark]}</td>
		<td>{[item.addtime]}</td>
		<td>{[item.edittime]}</td>
		<td>{[item.admin_manager_id]}</td>
		<td>{[item.del_status]}</td>
		<td>{[item.app_id]}</td>


	</tr>
	{[/loop]}
</table>
</script>




<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/admin_managerindex",function (parameter){
		
		/**--tmpl-templatejavascript--**/
		
		<!--tmpl-templatejavascript-->

		parameter.admin_role_assoc_url="{$admin_role_assoc_url}";

		parameter.detailUrl="{$detail_url}";
		parameter.deleteUrl="{$delete_url}";
		parameter.editUrl="{$do_edit_url}";
		parameter.upload_url="{$upload_url}";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";
		
		parameter.init();		
	});
</script>


<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li> 
		{[loop pages page]}

		<li {[if curr == page]}class="active"{[/if]}><a class="assoc-page" data-page="{[page]}"  href="javascript:void(0)">{[page]}</a></li> 

		{[/loop]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li> 
	</ul>	
</div>
</script>
</body>
</html>
